package com.gitee.dufafei.plugin.core;

import java.net.URL;
import java.util.Map;

public class Plugin implements PluginInterface {

    private Class<? extends PluginTypeInterface> pluginType;
    private String id;
    private String name;
    private String category;
    private String description;
    private Map<String, Object> expandInformation;
    private String className;
    private boolean isNative;
    private URL[] libraries;

    @Override
    public Class<? extends PluginTypeInterface> getPluginType() { return pluginType; }

    @Override
    public void setPluginType(Class<? extends PluginTypeInterface> pluginType) { this.pluginType = pluginType; }

    @Override
    public String getId() { return id; }

    @Override
    public void setId(String id) { this.id = id; }

    @Override
    public String getName() { return name; }

    @Override
    public void setName(String name) { this.name = name; }

    @Override
    public String getCategory() { return category; }

    @Override
    public void setCategory(String category) { this.category = category; }

    @Override
    public String getDescription() { return description; }

    @Override
    public void setDescription(String description) { this.description = description; }

    @Override
    public Map<String, Object> getExpandInformation() { return expandInformation; }

    @Override
    public void setExpandInformation(Map<String, Object> expandInformation) { this.expandInformation = expandInformation; }

    @Override
    public String getClassName() { return className; }

    @Override
    public void setClassName(String className) { this.className = className; }

    @Override
    public boolean isNative() { return isNative; }

    @Override
    public void setNative(boolean isNative) { this.isNative = isNative; }

    @Override
    public URL[] getLibraries() { return libraries; }

    @Override
    public void setLibraries(URL[] libraries) { this.libraries = libraries; }

    @Override
    public int hashCode() { return id.hashCode(); }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (!(obj instanceof Plugin)) {
            return false;
        }
        Plugin plugin = (Plugin) obj;
        return plugin.getId().equals(id);
    }

    @Override
    public String toString() { return id + "/" + name; }
}
